package com.wyc.internalCommon.util;

/**
 * redis中缓存的key前缀定义
 */
public class RedisKeyUtils {

    /**
     * 手机验证码前缀
     */
    public static final String VERIFICATION_CODE_PREFIX = "verification:code:";

    /**
     * 设置token_key前缀
     */
    public static final String TOKEN_PREFIX = "token:";

    /**
     * 设备唯一码前缀
     */
    public static final String BLACK_DEVICE_CODE_PREFIX = "black:device:";

    /**
     * 根据用户手机号生成验证码key
     * @param passengerPhone
     * @return
     */
    public static String generatorCodeKeyByPhone(String passengerPhone,String IdEntity) {
        String numCodeKey=VERIFICATION_CODE_PREFIX+IdEntity+":"+ passengerPhone;
        return numCodeKey;
    }

    /**
     * 根据用户手机号和身份标识生成token_key
     * @param passengerPhone
     * @return
     */
    public static String generatorTokenKeyByPhoneWithId(String passengerPhone,String identity,String tokenType) {
        String tokenKey=TOKEN_PREFIX+passengerPhone+":"+identity+":"+tokenType;
        return tokenKey;
    }

}
